package com.financing.wap.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.financing.wap.common.SqlName;
import com.financing.wap.dao.ICorpDao;
import com.financing.wap.dto.CompanyInvitationCodeDTO;
import com.financing.wap.dto.CorpDeptDTO;
import com.financing.wap.dto.CorpFaUserDTO;
import com.financing.wap.dto.FaUserCertDTO;
import com.financing.wap.vo.CorpDeptVO;
import com.financing.wap.vo.CorpFaUserVO;



@Repository("corpDao")
@SuppressWarnings(value={"deprecation", "unchecked"})
public class CorpDaoImpl extends BaseDaoImpl<FaUserCertDTO, java.lang.Integer> implements ICorpDao {

	@Override
	public Class<FaUserCertDTO> getEntityClass() {
		return FaUserCertDTO.class;
	}

	@Override
	public String addCorpFaUser(CorpFaUserDTO dto) {
		dto.setId((String)this.sqlMapClientTemplate.queryForObject(SqlName.queryUUID));
		this.sqlMapClientTemplate.insert(SqlName.CORP_INSERT, dto);
		return dto.getId();
	}

	@Override
	public List<CorpFaUserDTO> getCorpUserFaList(CorpFaUserVO vo) {
		List<CorpFaUserDTO> list = this.sqlMapClientTemplate.queryForList(SqlName.CORP_FA_LIST,vo);
		return list;
	}

	@Override
	public List<CorpDeptDTO> getCorpDeptList(CorpDeptVO vo) {
		List<CorpDeptDTO> list = this.sqlMapClientTemplate.queryForList(SqlName.CORP_DEPT_LIST,vo);
		return list;
	}

	@Override
	public Integer insertCorpDept(CorpDeptDTO dto) {
		int id = (Integer)this.sqlMapClientTemplate.insert(SqlName.CORP_DEPT_INSERT, dto);
		return id;
	}

	@Override
	public Integer updateCorpDeptList(CorpDeptDTO dto) {
		int id = (Integer)this.sqlMapClientTemplate.update(SqlName.CORP_DEPT_UPDATE, dto);
		return id;
	}

	@Override
	public CorpDeptDTO getCorpDeptViewById(CorpDeptVO vo) {
		CorpDeptDTO dto = (CorpDeptDTO)this.sqlMapClientTemplate.queryForObject(SqlName.CORP_DEPT_VIEW,vo);
		return dto;
		
		
	}

	@Override
	public Integer getCorpUserFaCount(CorpFaUserVO vo) {
		Integer count = (Integer)this.sqlMapClientTemplate.queryForObject(SqlName.CORP_FA_COUNT,vo);
		return count;
	}

	@Override
	public CorpFaUserDTO getCorpUserFaView(CorpFaUserVO vo) {
		CorpFaUserDTO dto = (CorpFaUserDTO)this.sqlMapClientTemplate.queryForObject(SqlName.CORP_FA_VIEW,vo);
		return dto;
	}

	@Override
	public CompanyInvitationCodeDTO getCorpInvitationCode(CompanyInvitationCodeDTO cic) {
		return (CompanyInvitationCodeDTO)this.sqlMapClientTemplate.queryForObject(SqlName.COMPANY_INVITATION_CODE,cic);
	}

}
